<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="../templates/ui.xhtml">

	<ui:define name="content">

		<h1 class="title ui-widget-header ui-corner-all">FileUpload - Simple</h1>
		<div class="entry">
            <p>Simple uploader uses native browser file upload. Simple uploader is disabled at online demo.</p>

            <h:form enctype="multipart/form-data">

                <p:messages showDetail="true"/>

				<p:fileUpload value="#{fileUploadController.file}" mode="simple" disabled="true"/>

                <br /><br />

                <p:commandButton value="Submit" ajax="false" actionListener="#{fileUploadController.upload}" disabled="true"/>

			</h:form>

			<h3>Source</h3>
            <p:tabView>
                <p:tab title="fileUploadSimple.xhtml">
                    <pre name="code" class="xml">
&lt;h:form enctype="multipart/form-data"&gt;

    &lt;p:messages showDetail="true"/&gt;

    &lt;p:fileUpload value="\#{fileUploadController.file}" mode="simple"/&gt;

    &lt;p:commandButton value="Submit" ajax="false"
                actionListener="\#{fileUploadController.upload}"/&gt;

&lt;/h:form&gt;
                    </pre>
                </p:tab>

                <p:tab title="FileUploadController.java">
                    <pre name="code" class="java">
package org.primefaces.examples.view;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.primefaces.model.UploadedFile;

public class FileUploadController {

    private UploadedFile file;

    public UploadedFile getFile() {
        return file;
    }

    public void setFile(UploadedFile file) {
        this.file = file;
    }

    public void upload() {
        if(file != null) {
            FacesMessage msg = new FacesMessage("Succesful", file.getFileName() + " is uploaded.");
            FacesContext.getCurrentInstance().addMessage(null, msg);
        }
    }
}
                    </pre>
                </p:tab>
            </p:tabView>
	
		</div>

	</ui:define>
</ui:composition>
